package com.blog.vueblogx.common.lang;

import lombok.Getter;

import java.io.Serializable;

/**
 * @version 1.0
 * @Author: 许啸林
 * @Date: 2022/2/13 9:37
 */
@Getter
public class Result implements Serializable {
    private int code;
    private String msg;
    private Object data;

    public static Result success(int code, String msg, Object data) {
        return new Result(code, msg, data);
    }

    public static Result success( Object data) {
        return new Result(200, "", data);
    }
    public static Result error(int code, String msg, Object data) {
        return new Result(code, msg, data);
    }
    public static Result error(String msg) {
        return new Result(500, msg, null);
    }

    public Result(int code,String msg,Object data) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

}
